#include<stdio.h>

int main()
{
	int k, m = 2, sign = 0, key = 0, i;
	scanf("%d", &k);
	while (1)
	{
		key = 0;
		for (i = 0; i < k; i++)
		{
			key = (key + m - 1) % (2 * k - i);
			if (key < k)
				break;
			if (i == k - 1)
			{
				sign = 1;
				break;
			}
		}
		if (sign == 1)
			break;
		m += 1;
	}
	printf("%d", m);
	return 0;
}